package services;

import domain.entities.Compromisopais;
import domain.entities.CompromisopaisDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: nico
 * Date: 8/9/12
 * Time: 2:30 PM
 * To change this template use File | Settings | File Templates.
 */
@Service
public class CompromisoPaisService {

    private CompromisopaisDAO compromisoPaisDao;

    public CompromisoPaisService() {
    }

    @Autowired
    public CompromisoPaisService(CompromisopaisDAO compromisoPaisDao) {
        this.compromisoPaisDao = compromisoPaisDao;
    }

    public List<Compromisopais> findAll(){
        return compromisoPaisDao.findAll();
    }

    public List<Compromisopais> findByProtocoloId(String protocoloId){
        return compromisoPaisDao.findByProtocoloId(protocoloId);
    }

    public Compromisopais findById(Integer compromisopaisId){
        return compromisoPaisDao.findById(compromisopaisId);
    }

    public Compromisopais findByCountry(String country){
        return (Compromisopais)compromisoPaisDao.findByProperty("country", country.trim()).get(0);
    }

    public List<Compromisopais> findByProtocoloMiembroBMsId(String protocoloId, Integer miembroBmsId){
        return compromisoPaisDao.findByProtocoloMiembroBMsId(protocoloId, miembroBmsId);
    }

}
